package com.misweb.ibase;

public class GlobalData {
    private static Cookies cookies=null;
    public static final String Cookie_SessionId="ASP.NET_SessionId";
    public static final String Cookie_CCS="CCS";
    public static final String Cookie_DotNet="DotNet";

    public static final String Cookie_CookieLaowugongren="CookieLaowugongren";

    public final static String getCookieString()  {


        if(cookies!=null){
            return  GlobalData.Cookie_SessionId+"="+cookies.Cookie_SessionId+";"
                    +GlobalData.Cookie_DotNet+"="+cookies.Cookie_DotNet+";"
                    +GlobalData.Cookie_CCS+"="+cookies.Cookie_CCS+";";
        }
        return null;
    }
    public final static String getLaowugongrenCookieString()  {


        if(cookies!=null){
            return  GlobalData.Cookie_CookieLaowugongren+"="+cookies.Cookie_Laowugongren+";";
        }
        return null;
    }
    public final static void changeCookiesFromlaowugongren(Cookies temp){
        if(cookies==null){
            //初始化
            cookies=temp;
        }else{
            cookies.Cookie_Laowugongren=temp.Cookie_Laowugongren;
        }


    }

    public final static void changeCookiesFromNet(Cookies temp){


        String sessionChange="Cookies";
        if(temp==null){
            return;
        }
        if(cookies==null){
            //初始化
            cookies=temp;
            sessionChange+="初始化：";
        }else {

            if(temp.SetCookiesTime!=null){
                cookies.SetCookiesTime=temp.SetCookiesTime;
                sessionChange+="重置SetCookiesTime：";
            }
            if(temp.Cookie_SessionId!=null){
                cookies.Cookie_SessionId=temp.Cookie_SessionId;
                sessionChange+="重置Cookie_SessionId：";

            }
            if(temp.Cookie_DotNet!=null){
                cookies.Cookie_DotNet=temp.Cookie_DotNet;
                sessionChange+="重置Cookie_DotNet：";
            }
            if(temp.Cookie_CCS!=null){
                cookies.Cookie_CCS=temp.Cookie_CCS;
            }
        }

    }
}
